UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zeJGFkeajj6nmSw0xRyS62nsQZxf+y+yjYoGzfrDit0=' 
WHERE 
  key_id = 'aaa80102f44653bdf8731ca6c2871ef2335c35174894faf2c55c4f4220bec312' 
  AND (
    token = 'zeJGFkeajj6nmSw0xRyS62nsQZxf+y+yjYoGzfrDit0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029