UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f6UQD0Wr+o+2yrIdZRgviaYsGi/NuFALVJW1pVz4L68='
WHERE
key_id = 'eec58486cd344d036b1c933aced837b9950f1d6ff0c88a45781042c0dd4a20ba'
AND (
token = 'f6UQD0Wr+o+2yrIdZRgviaYsGi/NuFALVJW1pVz4L68='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)