UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AXGQ5US9tn8KDtIWE3oRI8gqYn7g2qW2gyMPXjc6wpk=' 
WHERE 
  key_id = '778ec6581c7277e735f9159788f043d634f0bdc9b37dca8d272f231f4ab9c336' 
  AND (
    token = 'AXGQ5US9tn8KDtIWE3oRI8gqYn7g2qW2gyMPXjc6wpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031