UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pRo4WoqBGIJzWY3kAyVznAfH2lZBLOfI6F53xaS2MEk='
WHERE
key_id = 'e5af35b9a47192e0234e112391a4554d349af3190da8634391f6c2d82471ee7c'
AND (
token = 'pRo4WoqBGIJzWY3kAyVznAfH2lZBLOfI6F53xaS2MEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)