UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y8AGdn7yqAZROmMXcl25lINte1rmQoeFdIk3zXANLc0='
WHERE
key_id = '5290b2d10d944e63f566cc0c6ec6a346ac8db998ba5d161c547b95c5892af97f'
AND (
token = 'y8AGdn7yqAZROmMXcl25lINte1rmQoeFdIk3zXANLc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)