UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bTZqIHeEMWYrwTVKDCOLoKyJX9aEGp18u26eNZs8//U=' 
WHERE 
  key_id = '184013df4eb388fbcc8c1e45d19d4a50089b3be6819767e1227d8a5cec267752' 
  AND (
    token = 'bTZqIHeEMWYrwTVKDCOLoKyJX9aEGp18u26eNZs8//U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037