UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZzXtGsSmvOxNeGH7/5RqxhCGrjJ4R2l0zIcoKOsAerk=' 
WHERE 
  key_id = 'b61e141425546d4496da164004148cfc40faba4f24b7fcabe730f0559b073327' 
  AND (
    token = 'ZzXtGsSmvOxNeGH7/5RqxhCGrjJ4R2l0zIcoKOsAerk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026