UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QDYbVTMfRfZaF5jdk7CbgwQSSCnGjwLD5iHU3zGXHT8='
WHERE
key_id = '29c4f3c47bc6db1c528c07b2be7d8731b846884cf45ef905a26364372e552713'
AND (
token = 'QDYbVTMfRfZaF5jdk7CbgwQSSCnGjwLD5iHU3zGXHT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)