UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5fmJeaJOksS9wWlMTp4TQ9kKUB4tO900qLzeBn/nnZo='
WHERE
key_id = 'd8791e27799749cb4d9b01123c3dc718b224cfdb34be433f0ea3d025831185f2'
AND (
token = '5fmJeaJOksS9wWlMTp4TQ9kKUB4tO900qLzeBn/nnZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)