UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iK7OLSasI8uIrEq+3VPur11+ENZ1bLcp4Dvgf1zTcq4='
WHERE
key_id = '422c287b100760b577bf7716a79d78738905b85eba0be16273fe70d7d7105f9c'
AND (
token = 'iK7OLSasI8uIrEq+3VPur11+ENZ1bLcp4Dvgf1zTcq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)