UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bQ4So+SMwgTAiEwcDq0SPdc0xiUDddZ48ObigJTIqQ8='
WHERE
key_id = 'c5221817258a54c3cba3679f006c6fe4f67c6b0e55ea162634ac4661ea97e5b5'
AND (
token = 'bQ4So+SMwgTAiEwcDq0SPdc0xiUDddZ48ObigJTIqQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)