UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uGsYIYSLXljjwc/ghM7cgcjM/47CjJcL935TJqu28yg=' 
WHERE 
  key_id = '5384db423ee367acefa092426b31b2786112c03a9a85d60730d305b4c662175d' 
  AND (
    token = 'uGsYIYSLXljjwc/ghM7cgcjM/47CjJcL935TJqu28yg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037