UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U9GJxffCJuBkyyoscVPcIHGoZF52sA9Bm2ISwuC2MrM='
WHERE
key_id = '0be8bfc4719ebae41e59cf391b9d0af6fbc8b3b61faeacfa75b9ac6389100a8d'
AND (
token = 'U9GJxffCJuBkyyoscVPcIHGoZF52sA9Bm2ISwuC2MrM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)