UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u0sujgHqQGG72nhqud0floN/YhjZalD9/ivtYmiTzK8='
WHERE
key_id = 'd66d2df924df815179f937b8e47341e18f2ece8d5716bb7196c26c8f9f352b62'
AND (
token = 'u0sujgHqQGG72nhqud0floN/YhjZalD9/ivtYmiTzK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)