UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fG8OKStTdX71Px4++jgQTW5lQ0hb2nVMY2YeTXin+V8=' 
WHERE 
  key_id = 'f097f024b3778d28364610107be793db4b6beb6d3670b1199b50fd2636926c2c' 
  AND (
    token = 'fG8OKStTdX71Px4++jgQTW5lQ0hb2nVMY2YeTXin+V8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032