UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S0GfLix8lAcAFJWdrd36isWC2Rs9roVm7k1ySlFdBQQ='
WHERE
key_id = 'b787b3c97d3e652fb308a575b1a98427097acb0f6b3fe45cd57243faeb36f468'
AND (
token = 'S0GfLix8lAcAFJWdrd36isWC2Rs9roVm7k1ySlFdBQQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)