UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E8UqPjpBEqy4fCwY0pWUL1bv+RRkB3Zq+oK4z+2EeTQ='
WHERE
key_id = 'e9f79cc97a9b3b2bc4f0b7d4c75f914c7300a89bab70557e09e0e03c13ac66ee'
AND (
token = 'E8UqPjpBEqy4fCwY0pWUL1bv+RRkB3Zq+oK4z+2EeTQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)