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