UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P9ViiQ3dw5YbvOvk+I23WzXTETVUZYkkFeldNSk0+tU='
WHERE
key_id = '99830ab70b0b47e8b3d3e75e0ae4c85b6bb6ff2e580f9793fc4ddb3eeb0d529c'
AND (
token = 'P9ViiQ3dw5YbvOvk+I23WzXTETVUZYkkFeldNSk0+tU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)