UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bepllB6rNZomWGyz2uPDmE52JchMnYlWNSQeXpg4TQU=' 
WHERE 
  key_id = '5dd7588a1031affd362642e95b8f55a1143cec43e9c7bdfc494c66f42711bc2f' 
  AND (
    token = 'bepllB6rNZomWGyz2uPDmE52JchMnYlWNSQeXpg4TQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028