UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IgXjJLo4mHDCeMtgDKccNFYVms3qIatHjCUN9Qz3iqw='
WHERE
key_id = 'fe0b98f1acff967bb113a6f7f32e97cb395dedd5b71115c93d4f3846df9c4672'
AND (
token = 'IgXjJLo4mHDCeMtgDKccNFYVms3qIatHjCUN9Qz3iqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)