UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qeHjrA3SvmH/ZwN86M1kZbsvsLUUO09ityEtOpncrpA=' 
WHERE 
  key_id = '6a1e4f9b4fe0f64f3c90c4814f7c3a1ab89fd80c5980f25410db48970d7e224a' 
  AND (
    token = 'qeHjrA3SvmH/ZwN86M1kZbsvsLUUO09ityEtOpncrpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048