UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7EDQohyDhPVo3WXZXmQlp58DSeS6qMizIm9tKzNypME=' 
WHERE 
  key_id = '0cd4e0e5c9976505d2712feb790037945654d25be553f78ff4dfd133c17abc41' 
  AND (
    token = '7EDQohyDhPVo3WXZXmQlp58DSeS6qMizIm9tKzNypME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040