UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bkdd54IQG0qRff574Zh/ww6sX0DVoTboXeusppF+esE='
WHERE
key_id = '7ea9f231546c1bda9529a717c2057856922c7a22aef0b7e0bdde9a73837b457d'
AND (
token = 'bkdd54IQG0qRff574Zh/ww6sX0DVoTboXeusppF+esE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)