UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NpEEr/buSEYwc8enlfisce92F0F093X8umQ2Op0sj04=' 
WHERE 
  key_id = '886e68a55a37c1a514052a458bdb8ff31a8438f8b2489d9a35c7c5a09acacab8' 
  AND (
    token = 'NpEEr/buSEYwc8enlfisce92F0F093X8umQ2Op0sj04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029