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