UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mp8oAO1jxOhmF5oxPMgKGr8CeGW0dN7OWgwVqyIsYV0='
WHERE
key_id = '118b6e9c9f5ce68a0dda4c361149d75f824f5db90cba312973f5c5d00326529d'
AND (
token = 'mp8oAO1jxOhmF5oxPMgKGr8CeGW0dN7OWgwVqyIsYV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)