UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BG5B+Pry1tMvc1R1/GQJ16Y3snZ4mvzsygYmqi+QfDM='
WHERE
key_id = 'cf07b2a2806afdea82b07002edafd791d49e8814e43395737db6deb0df73c98a'
AND (
token = 'BG5B+Pry1tMvc1R1/GQJ16Y3snZ4mvzsygYmqi+QfDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)