UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eYH67THW41OcsaIBpuT8hqqQH51DX+iwu9r3J0kj8BY=' 
WHERE 
  key_id = '7318f27566d82415975d9b17aed6e19e011616bfacb4712517bb4bb8c24aab4a' 
  AND (
    token = 'eYH67THW41OcsaIBpuT8hqqQH51DX+iwu9r3J0kj8BY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024