UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7H4ZC8b6it9XF9iej8l0uw7pK25cCblDQeo6Yj1SApY=' 
WHERE 
  key_id = '20a87436a12465694e779685cfb35393f9496878fe68577ca804f6f05a9cc4e3' 
  AND (
    token = '7H4ZC8b6it9XF9iej8l0uw7pK25cCblDQeo6Yj1SApY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050