UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oXTCz/KxKV0MT3ccNAMeKIex68+09lDB6Lh6nTARM4M='
WHERE
key_id = 'd1e8dce0fad7062be40178ab9d5565ab0e66f5feaf78b3a81347cac6a8ac7d31'
AND (
token = 'oXTCz/KxKV0MT3ccNAMeKIex68+09lDB6Lh6nTARM4M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)