UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3g4DjvYw17dTSBZiVohBKbREwYOb/T5KeIyup1+bY+g='
WHERE
key_id = '1fde8facd20263fa1aadb2c118ead58e9802a23ba9f65509a3af604b91afce75'
AND (
token = '3g4DjvYw17dTSBZiVohBKbREwYOb/T5KeIyup1+bY+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)