UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S+/8gSu4HEhCupOOs+JAUc9IB4AN9pnZExJDB+kYOUQ=' 
WHERE 
  key_id = '956831f3493288d416d21f7f0da835eccbaff7cf421038bdfde7f1397a3040e8' 
  AND (
    token = 'S+/8gSu4HEhCupOOs+JAUc9IB4AN9pnZExJDB+kYOUQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027