UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xnv6+yQljZWwToT8E8nBer0VTOC1qS2qk0+QDseeYaM='
WHERE
key_id = 'e2ede5e7e95156405d6d68ba15e429681ebdf0c73cc77e63450e08c10b7b57b7'
AND (
token = 'xnv6+yQljZWwToT8E8nBer0VTOC1qS2qk0+QDseeYaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)